<!-- 表格插件 -->
<script src="/static/plugins/bootstrap-table/bootstrap-table.js" type="text/javascript"></script>
<script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js" type="text/javascript"></script>
<script src="/static/plugins/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js"></script>
<script src="/static/plugins/bootstrap-table/extensions/export/bootstrap-table-export.min.js"></script>
<script src="/static/plugins/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.min.js"></script>
<script src="/static/plugins/echarts/echarts.min.js"></script>
<script src="/static/plugins/echarts/theme/macarons.js"></script>
<script src="/static/product/scripts/todaySeconds.js"></script>

<script>
    var $dataGrid = $('#dataGrid');
    var $searchForm = $("#searchForm");

    var electricityChart = echarts.init(document.getElementById('electricityChart'), 'macarons');
    var voltageChart = echarts.init(document.getElementById('voltageChart'), 'macarons');
    var powerfactorChart = echarts.init(document.getElementById('powerfactorChart'), 'macarons');
    var totalPateeChart = echarts.init(document.getElementById('totalPateeChart'), 'macarons');

    var A_electricity_list = [];
    var B_electricity_list = [];
    var C_electricity_list = [];

    var A_voltage_list = [];
    var B_voltage_list = [];
    var C_voltage_list = [];

    var A_power_factor_list = [];
    var B_power_factor_list = [];
    var C_power_factor_list = [];
    var Total_power_factor_list = [];

    var Total_p_at_ee_list = [];


    //初始化加载
    $(function () {
        pageInit();
    });

    //初始化页面
    function pageInit() {
        //初始化查询条件
        queryParamsInit();

        //初始化表格
        dataGridInit();

        echartsInit();

        //搜索
        $("#btnSearch").on("click", function (e) {
            refreshToFirstPage();

            collectRowsToday();
        });

        //清除搜索
        $("#btnClearSearch").on("click", function (e) {
            $('select', $searchForm).selectpicker('val', '');
            $('input', $searchForm).val('');

            refreshToFirstPage();
        });

        //保持搜索条件面板状态
        sdtheme.searchPanelStatusInit('searchpanelbtn');

        $(window).resize(function () {
            electricityChart.resize();
            voltageChart.resize();
            powerfactorChart.resize();
            totalPateeChart.resize();
        });
    }

    //刷新并跳转至第一页
    function refreshToFirstPage() {
        //表格刷新时，保存查询条件到cookie
        sdtheme.saveSearchText('searchForm');

        //刷新并跳转至第1页
        $dataGrid.bootstrapTable('refresh', {pageNumber: 1});

        //同时要更新cookie里保存当前页码
        $.cookie('dataGrid.bs.table.pageNumber', 1, {expires: 1});
    }

    //查询条件初始化
    function queryParamsInit() {
        //从cookie加载查询条件，传入参数为form id
        sdtheme.loadSearchText('searchForm');

        if($("#DTU_no").val().length == 0){
            $('.searchForm input[name="DTU_no"]').val('900000000001');
            $('.searchForm input[name="MeterAddress"]').val(1);
        }

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#CollectTime',
                value: new Date().format("yyyy-MM-dd"),
                max: 0
            });
        });
    }

    //bootstrap table data init
    function dataGridInit() {
        $dataGrid.bootstrapTable({
            method: 'post',
            url: '{{ urlfor "CollectBaseInfoController.DataGrid"}}',

            idField: 'CollectTime',     //标识哪个字段为id主键
            queryParamsType: 'limit',   //参数格式,发送标准的RESTFul类型的参数请求
            queryParams: function (params) {
                params.CollectTime  = $('.searchForm input[name="CollectTime"]').val();
                params.DTU_no       = $('.searchForm input[name="DTU_no"]').val();
                params.MeterAddress = $('.searchForm input[name="MeterAddress"]').val();
                return params;
            },
            striped: true,         //使表格带有条纹
            pagination: true,      //在表格底部显示分页工具栏
            showRefresh: true,     //显示刷新按钮
            showColumns: false,    //显示隐藏列
            toolbar: '#toolbar',    //设置工具栏的Id或者class
            sidePagination: 'server',   //分页方式：client客户端分页，server服务端分页
            pageSize: 10,
            pageList: [5, 10, 20, 100, 200],
            paginationShowPageGo: true,    //20170812 lht 扩展select跳转
            paginationUseBSSelect: true,   //20170812 lht 扩展select跳转 启用BoostrapSelect(页面须引用botstrap-select.min.js)
            cookie: true,
            classes: 'table table-bordered table-hover',
            undefinedText: '',
            sortName: 'CollectTime',
            sortOrder: 'asc',
            showToggle: true,        //是否显示详细视图和列表视图的切换按钮
            showExport: true,
            exportDataType: 'all',
            stickyHeader: true,

            columns: [
                [
                    {
                        field: 'CollectTime',
                        title: '采集时间',
                        valign: 'middle',
                        align: 'center',
                        class: 'W160',
                        formatter: sdtheme.formatterDateTimeBySpan,
                        colspan: 1,        //规定表头单元格可横跨的列数
                        rowspan: 2         //规定表头单元格可横跨的行数
                    }, {
                        field: 'DTU_no',
                        title: 'DTU编号',
                        valign:"middle",
                        align: 'center',
                        width: '120px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'MeterAddress',
                        title: '电表地址',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        title: "电流 (I)",
                        valign:"middle",
                        align:"center",
                        colspan: 3,
                        rowspan: 1
                    }, {
                        title: "电压 (V)",
                        valign:"middle",
                        align:"center",
                        colspan: 3,
                        rowspan: 1
                    }, {
                        title: "功率因数",
                        valign:"middle",
                        align:"center",
                        colspan: 4,
                        rowspan: 1
                    }, {
                        title: "视在功率",
                        valign:"middle",
                        align:"center",
                        colspan: 4,
                        rowspan: 1
                    }, {
                        title: "无功功率",
                        valign:"middle",
                        align:"center",
                        colspan: 4,
                        rowspan: 1
                    }, {
                        title: "有功功率",
                        valign:"middle",
                        align:"center",
                        colspan: 4,
                        rowspan: 1
                    }, {
                        title: "线电压(V)",
                        valign:"middle",
                        align:"center",
                        colspan: 3,
                        rowspan: 1
                    }, {
                        field: 'Total_p_at_ee',
                        title: '3相总正向有功电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_r_at_ee',
                        title: '3相总反向有功电能',
                        valign:"middle",
                        width: '110px',
                        align: 'center',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_p_reat_ee',
                        title: '3相总正向无功电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_r_reat_ee',
                        title: '3相总反向无功电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_at_ee',
                        title: '3相总有功电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_ap_reat_ee',
                        title: '3相总无功电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Total_ap_a_ee',
                        title: '3相总视在电能',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }, {
                        field: 'Frequency',
                        title: '频率',
                        valign:"middle",
                        align: 'center',
                        width: '110px',
                        colspan: 1,
                        rowspan: 2
                    }
                ],

                [
                    {
                        field: 'A_electricity',
                        title: 'A相电流',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_electricity',
                        title: 'B相电流',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_electricity',
                        title: 'C相电流',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'A_voltage',
                        title: 'A相电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_voltage',
                        title: 'B相电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_voltage',
                        title: 'C相电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'A_power_factor',
                        title: 'A相功率因数',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_power_factor',
                        title: 'B相功率因数',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_power_factor',
                        title: 'C相功率因数',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Total_power_factor',
                        title: '3相总功率因数',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'A_ap_power',
                        title: 'A相视在功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_ap_power',
                        title: 'B相视在功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_ap_power',
                        title: 'C相视在功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Total_ap_power',
                        title: '3相总视在功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'A_reactive_power',
                        title: 'A相无功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_reactive_power',
                        title: 'B相无功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_reactive_power',
                        title: 'C相无功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Total_reactive_power',
                        title: '3相总无功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'A_active_power',
                        title: 'A相有功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'B_active_power',
                        title: 'B相有功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'C_active_power',
                        title: 'C相有功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    },  {
                        field: 'Total_active_power',
                        title: '3相总有功功率',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Uab_line_voltage',
                        title: 'A,B线电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Ubc_line_voltage',
                        title: 'B,C线电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }, {
                        field: 'Uac_line_voltage',
                        title: 'A,C线电压',
                        width: '110px',
                        valign:"middle",
                        align: 'center'
                    }
                ]
             ],
            onLoadSuccess: function (data) {
                layer.closeAll('loading');
            },
            onSort: function (name, order) {

            },
            onPageChange: function () {

            },
            onCheckAll: function (rows) {

            },
            onCheck: function (rows) {

            },
            onUncheck: function (rows) {

            },
            onUncheckAll: function () {

            },
            onLoadError: function (status) {
                layer.alert('获取数据失败,错误代码：' + status);
            }
        });
    }

    function echartsInit(){
        var icon = 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z';
        var option = {
            title: {
                text: '24小时数据',
                subtext: '5分钟一条'
            },

            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                }
            },

            //下栏拉动条
            dataZoom: [{
                type: 'inside',
                start: 0
            }, {
                start: 0,
                handleIcon: icon,
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],

            //开关
            legend: {
                data:['A相电流','B相电流','C相电流']
            },

            //右侧工具栏
            toolbox:{
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: {show: true},
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },

            //表格布局
            grid: {
                left: '3%',
                right: '4%',
                bottom: '17%',
                containLabel: true
            },

            xAxis: {
                type: 'category',
                boundaryGap: false,
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#0E2A43'
                    }
                },
                data: date_list
            },

            yAxis: [
                {
                    type: 'value'
                }
            ],

            series: [ {
                name: 'A相电流',
                type: 'line',
                data: A_electricity_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(219,50,51)'
                    }
                }
            }, {
                name: 'B相电流',
                type: 'line',
                data: B_electricity_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(0,136,212)'
                    }
                }
            }, {
                name: 'C相电流',
                type: 'line',
                data: C_electricity_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(137,189,27)'
                    }
                }
            }]
        };
        electricityChart.setOption(option);

        //********************************************************************************************
        var option2 = {
            title: {
                text: '24小时数据',
                subtext: '5分钟一条'
            },

            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                }
            },

            //下栏拉动条
            dataZoom: [{
                type: 'inside',
                start: 0
            }, {
                start: 0,
                handleIcon: icon,
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],

            legend: {
                data:['A相电压','B相电压','C相电压']
            },
            toolbox:{
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: {show: true},
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            calculable: true,
            grid: {
                left: '3%',
                right: '4%',
                bottom: '17%',
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: date_list,
                splitLine: {
                    show: false
                }
            },
            yAxis: {
                axisLabel: {
                    formatter: function (val) {
                        return val;
                    }
                },
                splitLine: {
                    show: false
                },
                scale: true
            },
            series: [ {
                name: 'A相电压',
                type: 'line',
                data: A_voltage_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(219,50,51)'
                    }
                }
            }, {
                name: 'B相电压',
                type: 'line',
                data: B_voltage_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(0,136,212)'
                    }
                }
            }, {
                name: 'C相电压',
                type: 'line',
                data: C_voltage_list,
                smooth: true,
                showSymbol: false,
                itemStyle: {
                    normal: {
                        color: 'rgb(137,189,27)'
                    }
                }
            }]
        };
        voltageChart.setOption(option2);

        //********************************************************************************************
        var option3 = {
            title: {
                text: '24小时数据',
                subtext: '5分钟一条'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                }
            },

            //下栏拉动条
            dataZoom: [{
                type: 'inside',
                start: 0
            }, {
                start: 0,
                handleIcon: icon,
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],

            legend: {
                data:['A相功率因数','B相功率因数','C相功率因数', '3相总功率因数']
            },

            toolbox:{
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: {show: true},
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            calculable: true,
            grid: {
                left: '3%',
                right: '4%',
                bottom: '17%',
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: date_list,
                splitLine: {
                    show: false
                }
            },
            yAxis: {
                axisLabel: {
                    formatter: function (val) {
                        return val;
                    }
                },
                splitLine: {
                    show: false
                },
                scale: true
            },
            series: [ {
                name: 'A相功率因数',
                type: 'line',
                data: A_power_factor_list,
                markPoint: {
                    data: [
                        {type: 'max', name: '最大值'},
                        {type: 'min', name: '最小值'}
                    ]
                },
                smooth: true,
                showSymbol: false
            }, {
                name: 'B相功率因数',
                type: 'line',
                data: B_power_factor_list,
                markPoint: {
                    data: [
                        {type: 'max', name: '最大值'},
                        {type: 'min', name: '最小值'}
                    ]
                },
                smooth: true,
                showSymbol: false
            }, {
                name: 'C相功率因数',
                type: 'line',
                data: C_power_factor_list,
                markPoint: {
                    data: [
                        {type: 'max', name: '最大值'},
                        {type: 'min', name: '最小值'}
                    ]
                },
                smooth: true,
                showSymbol: false
            }, {
                name: '3相总功率因数',
                type: 'line',
                data: Total_power_factor_list,
                markPoint: {
                    data: [
                        {type: 'max', name: '最大值'},
                        {type: 'min', name: '最小值'}
                    ]
                },
                smooth: true,
                showSymbol: false
            }]
        };
        powerfactorChart.setOption(option3);

        //********************************************************************************************
        var option4 = {
            title: {
                text: '24小时数据',
                subtext: '5分钟一条'
            },

            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'     //鼠标随动虚线
                }
            },

            //下栏拉动条
            dataZoom: [{
                type: 'inside',
                start: 0
            }, {
                start: 0,
                handleIcon: icon,
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],

            legend: {
                data:['3相总正向有功电能']
            },
            toolbox:{
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: {show: true},
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            calculable: true,
            grid: {
                left: '3%',
                right: '4%',
                bottom: '17%',
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: date_list,
                splitLine: {
                    show: false
                }
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter: function (val) {
                        return val;
                    }
                },
                boundaryGap: [0, '100%'],
                scale: true
            },
            series: [ {
                name: '3相总正向有功电能',
                type: 'line',
                data: Total_p_at_ee_list,
                smooth: true,
                showSymbol: false
            }]
        };
        totalPateeChart.setOption(option4);
    }

    //echarts
    function collectRowsToday() {
        electricityChart.showLoading({
            text: '正在努力',
            color: '#c23531',
            textColor: '#000',
            maskColor: 'rgba(255, 255, 255, 0)',
            zlevel: 0
        });
        voltageChart.showLoading();
        powerfactorChart.showLoading();
        totalPateeChart.showLoading();

        A_electricity_list.splice(0, A_electricity_list.length);
        B_electricity_list.splice(0, B_electricity_list.length);
        C_electricity_list.splice(0, C_electricity_list.length);

        A_voltage_list.splice(0, A_voltage_list.length);
        B_voltage_list.splice(0, B_voltage_list.length);
        C_voltage_list.splice(0, C_voltage_list.length);

        A_power_factor_list.splice(0, A_power_factor_list.length);
        B_power_factor_list.splice(0, B_power_factor_list.length);
        C_power_factor_list.splice(0, C_power_factor_list.length);
        Total_power_factor_list.splice(0, Total_power_factor_list.length);

        Total_p_at_ee_list.splice(0, Total_p_at_ee_list.length);

        var url = '{{ urlfor "CollectBaseInfoController.DataList"}}';
        var params ={CollectTime: $('.searchForm input[name="CollectTime"]').val(),
                     DTU_no: $('.searchForm input[name="DTU_no"]').val(),
                     MeterAddress: $('.searchForm input[name="MeterAddress"]').val()
                     };
        $.sdpost(url, params, function (re) {
            if (re.code === 0) {
                re.obj.map(function (item, index, array) {
                    var idx = index > 0 ? index - 1 : 0;
                    var currentTime = new Date(item.CollectTime);
                    var diff = currentTime - new Date(array[idx].CollectTime);

                    if(diff > 15 * 60 * 1000){
                        var t = currentTime.getSeconds() + 1;
                        var tt = {'time': t, 'value':[t, ]};
                        A_electricity_list.push(tt);
                        B_electricity_list.push(tt);
                        C_electricity_list.push(tt);

                        A_voltage_list.push(tt);
                        B_voltage_list.push(tt);
                        C_voltage_list.push(tt);

                        A_power_factor_list.push(tt);
                        B_power_factor_list.push(tt);
                        C_power_factor_list.push(tt);
                        Total_power_factor_list.push(tt);

                        Total_p_at_ee_list.push(tt);
                    }

                    var time = currentTime.format("hh:mm:ss");
                    var ae = {'time': time, 'value':[time, item.A_electricity]};
                    var be = {'time': time, 'value':[time, item.B_electricity]};
                    var ce = {'time': time, 'value':[time, item.C_electricity]};
                    A_electricity_list.push(ae);
                    B_electricity_list.push(be);
                    C_electricity_list.push(ce);

                    var av = {'time': time, 'value':[time, item.A_voltage]};
                    var bv = {'time': time, 'value':[time, item.B_voltage]};
                    var cv = {'time': time, 'value':[time, item.C_voltage]};
                    A_voltage_list.push(av);
                    B_voltage_list.push(bv);
                    C_voltage_list.push(cv);

                    var ap = {'time': time, 'value':[time, item.A_power_factor]};
                    var bp = {'time': time, 'value':[time, item.B_power_factor]};
                    var cp = {'time': time, 'value':[time, item.C_power_factor]};
                    var tp = {'time': time, 'value':[time, item.Total_power_factor_list]};
                    A_power_factor_list.push(ap);
                    B_power_factor_list.push(bp);
                    C_power_factor_list.push(cp);
                    Total_power_factor_list.push(tp);

                    var te = {'time': time, 'value':[time, item.Total_p_at_ee]};
                    Total_p_at_ee_list.push(te);
                });

                electricityChart.hideLoading();
                electricityChart.setOption({
                    series:[
                        {data: A_electricity_list},
                        {data: B_electricity_list},
                        {data: C_electricity_list}
                    ]
                });

                voltageChart.hideLoading();
                voltageChart.setOption({
                    series:[
                        {data: A_voltage_list},
                        {data: B_voltage_list},
                        {data: C_voltage_list}
                    ]
                });

                powerfactorChart.hideLoading();
                powerfactorChart.setOption({
                    series:[
                        {data: A_power_factor_list},
                        {data: B_power_factor_list},
                        {data: C_power_factor_list},
                        {data: Total_power_factor_list}
                    ]
                });

                totalPateeChart.hideLoading();
                totalPateeChart.setOption({
                    series:[
                        {data: Total_p_at_ee_list}
                    ]
                });

            } else {
                layer.alert("collectRowsToday 数据获取失败", {icon: 2, title: '错误'})
            }
        });
    }

</script>


